CREATE TABLE [dbo].[TTORDE_DIST]
(
[CO_EMPR] [dbo].[TD_VC_002] NOT NULL,
[NU_ANNO] [dbo].[TD_IN_004_ANOS] NOT NULL,
[NU_MESE] [dbo].[TD_IN_002_MESE] NOT NULL,
[CO_ORDE_ORIG] [dbo].[TD_VC_020] NOT NULL,
[CO_ORDE_DEST] [dbo].[TD_VC_020] NOT NULL,
[PO_DIST] [dbo].[TD_NU_009_004] NULL CONSTRAINT [DF__TTORDE_DI__PO_DI__4F089A18] DEFAULT ((0)),
[CO_USUA_CREA] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TTORDE_DI__CO_US__4FFCBE51] DEFAULT (suser_sname()),
[FE_USUA_CREA] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TTORDE_DI__FE_US__50F0E28A] DEFAULT (getdate()),
[CO_USUA_MODI] [dbo].[TD_VC_008_USUA] NOT NULL CONSTRAINT [DF__TTORDE_DI__CO_US__51E506C3] DEFAULT (suser_sname()),
[FE_USUA_MODI] [dbo].[TD_DT_001_SIST] NOT NULL CONSTRAINT [DF__TTORDE_DI__FE_US__52D92AFC] DEFAULT (getdate())
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TTORDE_DIST] WITH NOCHECK ADD CONSTRAINT [CK__TTORDE_DI__NU_AN__4D2051A6] CHECK NOT FOR REPLICATION (([NU_ANNO]>(1980)))
GO
ALTER TABLE [dbo].[TTORDE_DIST] WITH NOCHECK ADD CONSTRAINT [CK__TTORDE_DI__NU_ME__4E1475DF] CHECK NOT FOR REPLICATION (([NU_MESE]>=(0) AND [NU_MESE]<=(13)))
GO
ALTER TABLE [dbo].[TTORDE_DIST] ADD CONSTRAINT [PK__TTORDE_D__E8236FA96AF0ABAF] PRIMARY KEY CLUSTERED  ([CO_EMPR], [NU_ANNO], [NU_MESE], [CO_ORDE_ORIG], [CO_ORDE_DEST]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[TTORDE_DIST] ADD CONSTRAINT [FK__TTORDE_DI__CO_EM__63A48FA2] FOREIGN KEY ([CO_EMPR]) REFERENCES [dbo].[TMPARA_TESO] ([CO_EMPR])
GO
